package com.platform.service.impl;

import com.platform.cache.J2CacheUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.platform.dao.IncomeCoinConfigDao;
import com.platform.entity.IncomeCoinConfigEntity;
import com.platform.service.IncomeCoinConfigService;

/**
 * 发币配置类Service实现类
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2019-02-02 02:05:50
 */
@Service("incomeCoinConfigService")
public class IncomeCoinConfigServiceImpl implements IncomeCoinConfigService {
    @Autowired
    private IncomeCoinConfigDao incomeCoinConfigDao;

    @Override
    public IncomeCoinConfigEntity queryObject(Long id) {
        return incomeCoinConfigDao.queryObject(id);
    }

    @Override
    public List<IncomeCoinConfigEntity> queryList(Map<String, Object> map) {
        return incomeCoinConfigDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return incomeCoinConfigDao.queryTotal(map);
    }

    @Override
    public int save(IncomeCoinConfigEntity tIncomeCoinConfig) {
        return incomeCoinConfigDao.save(tIncomeCoinConfig);
    }

    @Override
    public int update(IncomeCoinConfigEntity tIncomeCoinConfig) {
        J2CacheUtils.remove("REDIS_COIN_CONFIG_KEY::type"+tIncomeCoinConfig.getType());
        return incomeCoinConfigDao.update(tIncomeCoinConfig);
    }

    @Override
    public int delete(Long id) {
        IncomeCoinConfigEntity tIncomeCoinConfig =incomeCoinConfigDao.queryObject(id);
        J2CacheUtils.remove("REDIS_COIN_CONFIG_KEY::type"+tIncomeCoinConfig.getType());
        return incomeCoinConfigDao.delete(id);
    }

    @Override
    public int deleteBatch(Long[] ids) {
        return incomeCoinConfigDao.deleteBatch(ids);
    }

    @Override
    public IncomeCoinConfigEntity selectType(int type) {
        return incomeCoinConfigDao.selectType(type);
    }
}
